﻿//商品咨询
var option = {};
option.columns = [
             {
                 field: 'ID',
                 title: '序号'
             }, {
                 sortable: true,
                 field: 'PID',
                 title: '对应商品'
             }, {
                 field: 'Question',
                 title: '咨询问题',
             }, {
                 field: 'Answer',
                 title: '答复',
                 formatter: function (value, row, index) {
                     if (!row.Answer) {
                         return "<a  class='sphf' href='#' zxid='" + row.ID + "' rowindex='" + index + "'>待回复</a>";

                     } else {
                         return value;
                     }
                 }
             }, {
                 field: 'CreateUser',
                 title: '咨询人',
             }
];

$(document).ready(function () {
    $(".addForm,.EditForm").remove();
    $(".sphf").YanTip({
        title: "回复咨询",
        place: "top",
        content: '<textarea name="hf" class="content"  rows="3" style="width:98%">',
        showed: function ($tip) {
        },
        confirm: function ($tip, $dom) {
            var zxid = $dom.attr("zxid");
            var rowindex = $dom.attr("rowindex");
            var content = $tip.find('.content').val();
            $.post("../SpeList/DLLAjaxHandler.ashx", { Action: "HFZX", id: zxid, content: content },
                 function (data) {
                     if (data == "success") {
                         $("#FTGrid").bootstrapTable('updateRow', {
                             index: rowindex,
                             row: {
                                 Answer: content
                             }
                         });
                         $(".Yan_tip").remove();
                         toastr.success("操作成功");

                     } else {
                         toastr.error("操作失败");
                     }
                 });
        }
    });
});

